<?php
session_start();
header('Content-Type:text/html;charset=utf-8');
date_default_timezone_set("PRC");
require_once($_SERVER['DOCUMENT_ROOT'].'/public/func.php');
$config=require_once($_SERVER['DOCUMENT_ROOT'].'/public/config.php');
isset($_SESSION['vip']['account'])?($account=$_SESSION['vip']['account']):'';
isset($account)?($arr=selects($config,'vip',"where `account`='$account'")[0]):'';
//var_dump($id);
$carr=selects($config,'comment',"");
$carr0=select($config,'comment',"");
//var_dump($carr);
$count=count($carr);
//var_dump($count);
//$count=array_count_values($aid);
//var_dump($count);
$warr0=selects($config,'article',"");
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Contact Me</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

    <!-- Bootstrap styles -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
  

    <!-- Font-Awesome -->
    <link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css">

    <!-- Google Webfonts -->
    <!--<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600|PT+Serif:400,400italic' rel='stylesheet' type='text/css'>-->

    <!-- Styles -->
  <link rel="stylesheet" href="css/style.css" id="theme-styles">

    <!--[if lt IE 9]>      
        <script src="js/vendor/google/html5-3.6-respond-1.1.0.min.js"></script>
    <![endif]-->
    
</head>
<body>
    <header>
        <div class="widewrapper masthead">
            <div class="container">
                <a href="index.html" id="logo">
                    <img src="img/logo.png" alt="clean Blog">
                </a>

                <div id="mobile-nav-toggle" class="pull-right">
                    <a href="#" data-toggle="collapse" data-target=".clean-nav .navbar-collapse">
                        <i class="fa fa-bars"></i>
                    </a>
                </div>

                <nav class="pull-right clean-nav">
                    <div class="collapse navbar-collapse">
                        <ul class="nav nav-pills navbar-nav">
                          
                            <li>
                                <a href="/home/landing/index.php">登陆</a>
                            </li>
                            <li>
                                <a href="/home/index.php">首页</a>
                            </li>
                            <li>
                                <a href="/home/about.php">关于我</a>
                            </li>
                            <li>
                                <a href="/home/contact.php">留言板</a>
                            </li>
                            <li>
                                <a href="/home/destroy.php">
                                退出</a>
                            </li>                
                        </ul>
                    </div>
                </nav>        

            </div>
        </div>

        <div class="widewrapper subheader">
            <div class="container">
                <div class="clean-breadcrumb">
                    <a href="#"><?php echo (isset($arr['pname'])?'欢迎'.$arr['pname']:'');?>&nbsp;</a>
                </div>
                <div class="clean-searchbox">
                    <form action="#" method="get" accept-charset="utf-8">
                        
                        <input class="searchfield" id="searchbox" type="text" placeholder="搜索">
                         <button class="searchbutton" type="submit">
                            <i class="fa fa-search"></i>
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </header>
                    <!--<aside class="social-icons clearfix">
                        <h3>分享</h3> 
                        <a href="#"><i class="fa fa-facebook"></i></a> <a href="#"><i class="fa fa-twitter"></i></a> <a href="#"><i class="fa fa-google"></i></a>
                    </aside>-->

                    <aside class="comments" id="comments">
                        <hr>

                        <h2><i class="fa fa-comments"></i><?php echo $count.'条评论'?></h2>
                        <?php
                        foreach ($carr0 as $k => $v) {
                        echo
                    ' <article class="comment">
                            <header class="clearfix">
                                <img src="'.$v['mfile'].'" alt="A Smart Guy" class="avatar">
                                <div class="meta">
                                    <h3><a href="#">'.$v['uname'].'</a></h3>
                                    <span class="date">
                                        '.date('Y-m-d',$v['ctime']).'
                                    </span>
                                    <span class="separator">
                                        -
                                    </span>
                                    
                                    <a href="#create-comment" class="reply-link">回复</a>                
                                </div>
                            </header>
                             <div class="body">
                              '.$v['comment'].'
                            </div>
                        </article>';
                        }
                        ?>

                        <!--<article class="comment reply">
                            <header class="clearfix">
                                <img src="img/avatar.png" alt="A Smart Guy" class="avatar">
                                <div class="meta">
                                    <h3><a href="#">John Doe</a></h3>
                                    <span class="date">
                                        24 August 2015
                                    </span>
                                    <span class="separator">
                                        -
                                    </span>
                                    
                                    <a href="#create-comment" class="reply-link">Reply</a>                
                                </div>
                            </header>
                             <div class="body">
                               Lorem ipsum dolor sit amet, consectetur adipisicing elit. Facere sit perspiciatis debitis, vel ducimus praesentium expedita, assumenda ipsum cum corrupti dolorum modi. Rem ipsam similique sapiente obcaecati tenetur beatae voluptatibus.
                            </div>
                        </article>

                        <article class="comment ">
                            <header class="clearfix">
                                <img src="img/avatar.png" alt="A Smart Guy" class="avatar">
                                <div class="meta">
                                    <h3><a href="#">John Doe</a></h3>
                                    <span class="date">
                                        24 August 2015
                                    </span>
                                    <span class="separator">
                                        -
                                    </span>
                                    
                                    <a href="#create-comment" class="reply-link">Reply</a>                
                                </div>
                            </header>
                             <div class="body">
                               Lorem ipsum dolor sit amet, consectetur adipisicing elit. Facere sit perspiciatis debitis, vel ducimus praesentium expedita, assumenda ipsum cum corrupti dolorum modi. Rem ipsam similique sapiente obcaecati tenetur beatae voluptatibus.
                            </div>
                        </article>
                        <article class="comment">
                            <header class="clearfix">
                                <img src="img/avatar.png" alt="A Smart Guy" class="avatar">
                                <div class="meta">
                                    <h3><a href="#">John Doe</a></h3>
                                    <span class="date">
                                        24 August 2015
                                    </span>
                                    <span class="separator">
                                        -
                                    </span>
                                    
                                    <a href="#create-comment" class="reply-link">Reply</a>                
                                </div>
                            </header>
                             <div class="body">
                               Lorem ipsum dolor sit amet, consectetur adipisicing elit. Facere sit perspiciatis debitis, vel ducimus praesentium expedita, assumenda ipsum cum corrupti dolorum modi. Rem ipsam similique sapiente obcaecati tenetur beatae voluptatibus.
                            </div>
                        </article>-->        
                    </aside>
                     <hr>
                        <center>    
                        第<?php echo $_SESSION['p'] ?>页</a>&nbsp;
                        <a href="/home/contact.php?p=<?php echo $_SESSION['first']?>">首页</a>&nbsp;
                        <a href="/home/contact.php?p=<?php echo $_SESSION['prev']?>">上一页</a>&nbsp;
                        <a href="/home/contact.php?p=<?php echo $_SESSION['next']?>">下一页</a>&nbsp;
                        <a href="/home/contact.php?p=<?php echo $_SESSION['countpage']?>">尾页</a>&nbsp;
                        共<?php echo $_SESSION['countpage']?>页
                        </center>
    <div class="widewrapper main">
        <div class="container">
            <div class="row">
                <div class="col-md-6 col-md-offset-3 clean-superblock" id="contact">
                    <h2>留言</h2>
                    
                    <form action="/home/comment/add1.php" method="post" accept-charset="utf-8" class="contact-form">
                        <input  type="hidden" name="id" id="comment-name" class="form-control input-lg">
                        <input  type="hidden" name="aid"  value="" id="comment-name" class="form-control input-lg">
                        <input  type="hidden" name="cid" id="comment-name" class="form-control input-lg">
                        <input type="hidden" name="uname" value="<?php echo $arr['pname']?>" id="contact-name" placeholder="姓名" class="form-control input-lg">
                        <input type="hidden" name="ctime" id="comment-name" placeholder="时间" value="<?php echo time()?>" class="form-control input-lg">
                        <input type="hidden" name="mfile" value="<?php echo $arr['mfile']?>" id="contact-name" placeholder="姓名" class="form-control input-lg">
                        <textarea rows="10" maxlength="100" name="comment" id="contact-body" placeholder="留言内容" class="form-control input-lg"></textarea>
                        <div class="buttons clearfix">
                            <button type="submit" class="btn btn-xlarge btn-clean-one">提交</button>
                        </div>                    
                    </form>
                </div>
            </div>        
        </div>
    </div>

   <footer>
        <div class="widewrapper footer">
            <div class="container">
                <div class="row">
                    <div class="col-md-4 footer-widget">
                        <h3> <i class="fa fa-user"></i>关于我</h3>

                       <p>一个程序员</p>
                       <p>刚开始接触php，学习完善技术是我现在的目标</p>
                    </div>

                    <div class="col-md-4 footer-widget">
                        <h3> <i class="fa fa-pencil"></i>最近的帖子</h3>
                        <ul class="clean-list">
                             <?php  
                        foreach ($warr0 as $key => $value) {
                       echo '<li><a href="">'.$value['title'].'</a></li>';
                            /*<li><a href="">Clean - Responsive HTML5 Template</a></li>
                            <li><a href="">Responsive Pricing Table</a></li>
                            <li><a href="">Yellow HTML5 Template</a></li>
                            <li><a href="">Blackor Responsive Theme</a></li>
                            <li><a href="">Portfolio Bootstrap Template</a></li>
                            <li><a href="">Clean Slider Template</a></li>*/
                            }?>
                        </ul>
                    </div>

                    <div class="col-md-4 footer-widget">
                        <h3> <i class="fa fa-envelope"></i>联系我</h3>

                        <p>邮箱:1440342422@qq.com</p>
                        <p>电话 17671786038</p>
                         <div class="footer-widget-icon">
                            <i class="fa fa-facebook"></i><i class="fa fa-twitter"></i><i class="fa fa-google"></i>
                        </div>
                    </div>
                   
                </div>
            </div>
        </div>
        <div class="widewrapper copyright">
                Copyright 2015
        </div>
    </footer>
    
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/modernizr.js"></script>

</body>
</html>